<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var sum = 0
        var n = 1
        // while （条件）{执行代码} 求1-100的和  奇数和？
        while(n<=100){
            sum = sum + n
            // n = n+1
            n +=1
        }
        document.write(sum)
        
        
        var sum1 = 0
        var n1 = 1
        do{
            sum1 = sum1 + n1
            n1 += 1
        }while(n1<=50)
        alert(sum1)
    </script>
</body>
</html>